package com.juc.threadPoolExecutor.threadPoolExecutor14;

import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * 
 * 欲执行任务的数量大于ThreadPoolExecutor线程池的
 * maximumPoolSize最大值时，在不同队列中会出现什么情况
 *
 */
public class LinkedBlockingDequeTest1 {

	//LinkedBlockingDeque使用带参构造
	//max值被参考
	public static void main(String[] args) {
		LinkedBlockingDeque<Runnable> linked = new LinkedBlockingDeque<Runnable>(2);
		System.out.println(linked.size());
		ThreadPoolExecutor executor = new ThreadPoolExecutor(2, 3, 5, TimeUnit.SECONDS, linked);
		executor.execute(new MyRunnable());
		executor.execute(new MyRunnable());
		executor.execute(new MyRunnable());
		executor.execute(new MyRunnable());
		executor.execute(new MyRunnable());
		System.out.println(executor.getPoolSize() + "     " + linked.size());
		//放入队列2个任务    执行3个任务
	}
}
